﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:Controls="clr-namespace:PSE.Framework.UI.Controls.SmartClient;assembly=PSE.Framework.UI.Controls">

    <!--BEGIN RADIOBUTTON-->
    <ControlTemplate x:Key="ControlRadioButton" TargetType="{x:Type Controls:RadioButton}">
        <BulletDecorator Background="Transparent">
            <BulletDecorator.Bullet>
                <Grid Height="20" Width="21" VerticalAlignment="Center">
                    <Border Height="17" Width="17" Padding="2">
                        <Border x:Name="Border" BorderBrush="{DynamicResource BrushRadioButtonBorder}" BorderThickness="1" Background="{DynamicResource BrushRadioButtonBackground}" Width="13" Height="13" CornerRadius="6">
                            <Grid>
                                <Ellipse x:Name="CheckMark" HorizontalAlignment="Left" Margin="2,2,0,0" VerticalAlignment="Top" Width="7.063" Height="7.062" Stroke="{x:Null}" Fill="{DynamicResource BrushRadioButtonCheckMarkFill}"/>
                                <Ellipse x:Name="Path" Fill="{x:Null}" HorizontalAlignment="Left" VerticalAlignment="Top" Width="11.2" Height="11.2" StrokeThickness="2" Visibility="Collapsed"/>
                            </Grid>
                        </Border>
                    </Border>
                    <Rectangle x:Name="RectangleBullet" Stroke="{DynamicResource BrushCheckBoxBorderFocused}" StrokeDashArray="2 2" StrokeThickness="1" SnapsToDevicePixels="true" Height="17" Width="17" VerticalAlignment="Center" Visibility="Collapsed"/>
                </Grid>
            </BulletDecorator.Bullet>
            <Grid Height="20">
                <Rectangle x:Name="RectangleContent" Stroke="{DynamicResource BrushRadioButtonBorderFocused}" StrokeDashArray="2 2" StrokeThickness="1" Margin="2" SnapsToDevicePixels="true" Height="15" VerticalAlignment="Center" Visibility="Collapsed"/>
                <ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="5,-0.7,0,0" VerticalAlignment="Center" RecognizesAccessKey="True" Style="{DynamicResource ControlFont}"/>
            </Grid>
        </BulletDecorator>
        <ControlTemplate.Triggers>
            <MultiTrigger>
                <MultiTrigger.Conditions>
                    <Condition Property="IsMouseOver" Value="True"/>
                    <Condition Property="IsMouseCaptured" Value="False"/>
                </MultiTrigger.Conditions>
                <Setter Property="Visibility" Value="Visible" TargetName="Path"/>
                <Setter Property="Width" Value="10.989" TargetName="Path"/>
                <Setter Property="Height" Value="10.997" TargetName="Path"/>
                <Setter Property="Stroke" Value="{DynamicResource BrushRadioButtonBackgroundHover}" TargetName="Path"/>
            </MultiTrigger>
            <Trigger Property="IsFocused" Value="True">
                <Setter Property="Visibility" Value="Visible" TargetName="RectangleContent"/>
            </Trigger>
            <MultiTrigger>
                <MultiTrigger.Conditions>
                    <Condition Property="IsFocused" Value="True"/>
                    <Condition Property="Content" Value=""/>
                </MultiTrigger.Conditions>
                <Setter Property="Visibility" Value="Collapsed" TargetName="RectangleContent"/>
                <Setter Property="Visibility" Value="Visible" TargetName="RectangleBullet"/>
            </MultiTrigger>
            <Trigger Property="IsMouseCaptured" Value="True">
                <Setter Property="Background" Value="{DynamicResource BrushRadioButtonBackgroundPressed}" TargetName="Border"/>
            </Trigger>
            <Trigger Property="IsChecked" Value="False">
                <Setter Property="Visibility" Value="Collapsed" TargetName="CheckMark"/>
            </Trigger>
            <Trigger Property="IsEnabled" Value="false">
                <Setter Property="Foreground" Value="{DynamicResource BrushRadioButtonForegroundDisabled}"/>
                <Setter Property="BorderBrush" Value="{DynamicResource BrushRadioButtonBorderDisabled}" TargetName="Border"/>
                <Setter Property="Background" Value="{DynamicResource BrushRadioButtonBackgroundDisabled}" TargetName="Border"/>
                <Setter Property="Fill" Value="{DynamicResource BrushRadioButtonCheckMarkFillDisabled}" TargetName="CheckMark"/>
            </Trigger>
        </ControlTemplate.Triggers>
    </ControlTemplate>

    <Style TargetType="{x:Type Controls:RadioButton}">
        <Setter Property="Foreground" Value="{DynamicResource BrushRadioButtonForeground}"/>
        <Setter Property="FocusVisualStyle" Value="{x:Null}"/>
        <Setter Property="Height" Value="21"/>
        <Setter Property="Width" Value="100" />
        <Setter Property="Template" Value="{StaticResource ControlRadioButton}"/>
    </Style>
    <!--END RADIOBUTTON-->
</ResourceDictionary>